package com.kizuki.design.chain2;

public enum SexEnum {
    MAN(1, "男"),
    WOMAN(2, "女"),
    UNKONW(3, "未知");

    private int id;
    private String sex;

    SexEnum(int id, String sex) {
        this.id = id;
        this.sex = sex;
    }

    public int getId() {
        return id;
    }

    public String getSex() {
        return sex;
    }

    public static SexEnum getSexEnum(int id){
        for (SexEnum sexEnum : SexEnum.values()) {
            if (sexEnum.getId() == id) {
                return sexEnum;
            }
        }
        return null;
    }
}
